#ifndef _HMIADAPTER_HAMADAPTERBASE_H_
#define _HMIADAPTER_HAMADAPTERBASE_H_

#include "ite/itu.h"
#include <stdint.h>
#include <stdbool.h>
#include <stdlib.h>

#define INVAILD_DEMOL   0xffff
#define MIN_PERIOD      1
#define INIT_PHYSIC_VALUR 0
#define MODULE_NULL     NULL
#define WIDGET_NULL     NULL
#define UPDATE_UI       true
#define MAIN_LAYER_MASK 0x01
#define DIGITAL_LAYER_MASK 0x02
#define LAYER_COUNT_MAX 3
#define OFF 0
#define ON  1
#define SIG_VAILD 0
#define SIG_INVAILD 1

/**
 * @brief ItuElement
 *
 * @param[1] Widget pointer
 * @param[2] init function
 * @param[2] refresh ui
 */
typedef struct ItuElement
{
    void (*init)(struct ItuElement*);
    void (*refresh)(struct ItuElement*, bool isUnconditional);
    void (*reporting_self_validity)(struct ItuElement* elememt);
    ITUWidget*   widget_;
    uint16_t     period_;
    uint8_t      isVaild_;
} ItuElement;

typedef struct ItuElementUnited
{
    ItuElement* views_;
    int         size_;
} ItuElementUnited;

/**
 * @brief ImeterModel
 *
 * @param[1] logic run function
 */

typedef struct ImeterModel
{
    void (*init)(void);
    void (*run)(void);
    void (*release)(void);
    uint32_t period_;
} ImeterModel;

typedef struct MeterModelUnited
{
    ImeterModel** models_;
    int           size_;
} MeterModelUnited;

typedef struct StateMachineBase
{
    void (*onEntry)(void);
    void (*onExit)(void);
    void (*onExecute)(void);
} StateMachineBase;

#endif